<!-- 预测统计 -->
<template>
  <div class="infoprofit_statistic">
    <div class="table w1021">
      <div class="tableTh tableTr flex">
        <span class="tableTd w175 high">预测指标</span>
        <span class="tableTd w175 left">每股收益</span>
        <span class="tableTd w175 left">每股净资产BPS</span>
        <span class="tableTd w175 left">净资产收益率ROE(平均)</span>
        <span class="tableTd w175 left">营业收入（万元）</span>
        <span class="tableTd w175 left">营业利润（万元）</span>
      </div>
      <div class="tableTh tableTr flex top" v-for="(val,key,index) in data" :key="index">
        <span class="tableTd w175 flex">
          <span class="w70 high">{{key}}</span>
          <span class="w100 flex wrap">
            <span class="tableTd w100 left bottom">预测值</span>
            <span class="tableTd w100 left">机构数</span>
          </span>
        </span>
        <span class="tableTd w175" v-for="(item,index) in val" :key="index">
          <span class="flex wrap">
            <span class="orange tableTd wAuto left bottom">{{item|filterVal("numberNo")}}</span>
            <span class="orange tableTd wAuto left">{{item.orgNum|filterVal("jia")}}</span>
          </span>
        </span>
      </div>
      <div class="tableNone orange w1021 top" v-if="JSON.stringify(data) == '{}'">暂无数据</div>
    </div>
  </div>
</template>

<script>
import { numberNo } from "../../script/api";
export default {
  data() {
    return {};
  },
  props: ["data"],
  filters: {
    filterVal(ops, num) {
      if (num == "jia") {
        return ops ? ops + "家" : "--";
      }
      if (ops.acctName == "营业收入" || ops.acctName == "营业利润") {
        let value = Number((ops.avgVal / 10000).toFixed(2)).toLocaleString();
        if (num) {
          const len = value.split(".")[1];
          value = len && len.length < 2 ? value + "0" : value;
          value = (ops.avgVal / 10000) % 1 == 0 ? value + ".00" : value;
        }
        return value.indexOf("NaN") == -1 ? value : "--";
      }
      if (num == "numberNo") {
        return numberNo(ops.avgVal, num);
      }
      return ops.avgVal ? ops.avgVal : "--";
    }
  },
  components: {},
  computed: {},
  mounted() {},
  methods: {}
};
</script>
<style lang='scss' scoped>
</style>